package com.zhangyu.eat.sql;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;

/**
 * Created by Administrator on 2016/9/22.
 */
public class UserDao {
    private final SQLiteDatabase mUb;

    public UserDao(Context context) {
        DBUser user = new DBUser(context);
        mUb = user.getWritableDatabase();
    }

    //获取数据库对象
    public SQLiteDatabase getDb() {
        if (mUb != null) {
            return mUb;
        }
        return null;
    }

    //用来执行一个sql语句
    public void execSql(String sql, String[] args) {
        if (args != null) {
            mUb.execSQL(sql, args);
        } else {
            mUb.execSQL(sql);
        }
    }
}
